<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/test/js/jquery/jquery-2.2.4.js"></script>
    <script type="text/javascript">
        $(function () {

            alert(localStorage['foo']);

            $("#A").click(function (event) {
                event.preventDefault();
                var adminName = $("#Aname").val(),
                        adminPassword = $("#Apassword").val();
                var url = "/admin/login";
                $.post(url, {
                    adminName: adminName,
                    adminPassword: adminPassword
                }, function (result) {
                    if (result.status === 1) {
                        alert("登录成功");
                    }
                    else alert("登陆失败");
//                    window.location.href = "/index.html";
                    alert(JSON.stringify(result));
                })
            });

            $("#B").click(function (event) {
                event.preventDefault();
                var adminPassword = $("#Bpassword").val();
                var url = "/admin/edit";
                $.post(url, {
                    adminPassword: adminPassword
                }, function (result) {
                    if (result.status === 1)
                        alert("修改成功");
                    else alert("修改失败");
                    alert(JSON.stringify(result));
                })
            });
        })
    </script>
</head>
<body>
<h3>管理员登录</h3>
<input id="Aname" placeholder="用户名" type="text">
<input id="Apassword" placeholder="密码" type="text">
<button id="A">管理员登录</button>
<hr>
<br><br>
<h3>管理员信息编辑</h3>
<input id="Bpassword" placeholder="密码" type="text">
<button id="B">管理员信息编辑</button>
<hr>
</body>
</html>